← Index
NYTProf Performance Profile   
For /usr/share/koha/opac/cgi-bin/opac/opac-search.pl
  Run on Tue Oct 15 11:58:52 2013
Reported on Tue Oct 15 12:02:31 2013

Filename(eval 1131)[/usr/share/perl/5.10/CGI.pm:869]
StatementsExecuted 74 statements in 319µs
Eval Invoked At/usr/share/perl/5.10/CGI.pm line 869
Sibling evals1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111255µs1.61msCGI::::headerCGI::header
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
# spent 1.61ms (255µs+1.35) within CGI::header which was called: # once (255µs+1.35ms) by C4::Output::output_with_http_headers at line 832 of CGI.pm
package CGI; sub header {
215µs18µs my($self,@p) = self_or_default(@_);
# spent 8µs making 1 call to CGI::self_or_default
31300ns my(@header);
4
512µs return "" if $self->{'.header_printed'}++ and $HEADERS_ONCE;
6
7111µs1323µs my($type,$status,$cookie,$target,$expires,$nph,$charset,$attachment,$p3p,@other) =
# spent 323µs making 1 call to CGI::Util::rearrange
8 rearrange([['TYPE','CONTENT_TYPE','CONTENT-TYPE'],
9 'STATUS',['COOKIE','COOKIES'],'TARGET',
10 'EXPIRES','NPH','CHARSET',
11 'ATTACHMENT','P3P'],@p);
12
13 # Since $cookie and $p3p may be array references,
14 # we must stringify them before CR escaping is done.
151200ns my @cookie;
1612µs for (ref($cookie) eq 'ARRAY' ? @{$cookie} : $cookie) {
17218µs4374µs my $cs = UNIVERSAL::isa($_,'CGI::Cookie') ? $_->as_string : $_;
# spent 368µs making 2 calls to CGI::Cookie::as_string, avg 184µs/call # spent 5µs making 2 calls to UNIVERSAL::isa, avg 3µs/call
1824µs push(@cookie,$cs) if defined $cs and $cs ne '';
19 }
201400ns $p3p = join ' ',@$p3p if ref($p3p) eq 'ARRAY';
21
22 # CR escaping for values, per RFC 822
2312µs for my $header ($type,$status,@cookie,$target,$expires,$nph,$charset,$attachment,$p3p,@other) {
241414µs if (defined $header) {
25 # From RFC 822:
26 # Unfolding is accomplished by regarding CRLF immediately
27 # followed by a LWSP-char as equivalent to the LWSP-char.
28946µs1816µs $header =~ s/$CRLF(\s)/$1/g;
# spent 12µs making 9 calls to CGI::CORE:regcomp, avg 1µs/call # spent 5µs making 9 calls to CGI::CORE:subst, avg 511ns/call
29
30 # All other uses of newlines are invalid input.
31954µs1828µs if ($header =~ m/$CRLF|\015|\012/) {
# spent 19µs making 9 calls to CGI::CORE:regcomp, avg 2µs/call # spent 9µs making 9 calls to CGI::CORE:match, avg 1µs/call
32 # shorten very long values in the diagnostic
33 $header = substr($header,0,72).'...' if (length $header > 72);
34 die "Invalid header value contains a newline not followed by whitespace: $header";
35 }
36 }
37 }
38
391700ns $nph ||= $NPH;
40
411300ns $type ||= 'text/html' unless defined($type);
42
4314µs115µs if (defined $charset) {
# spent 15µs making 1 call to CGI::charset
44 $self->charset($charset);
45 } else {
46 $charset = $self->charset if $type =~ /^text\//;
47 }
481300ns $charset ||= '';
49
50 # rearrange() was designed for the HTML portion, so we
51 # need to fix it up a little.
5211µs for (@other) {
53 # Don't use \s because of perl bug 21951
54430µs418µs next unless my($header,$value) = /([^ \r\n\t=]+)=\"?(.+?)\"?$/s;
# spent 18µs making 4 calls to CGI::CORE:match, avg 5µs/call
55472µs16354µs ($_ = $header) =~ s/^(\w)(.*)/"\u$1\L$2" . ': '.$self->unescapeHTML($value)/e;
# spent 282µs making 1 call to CGI::AUTOLOAD # spent 57µs making 3 calls to CGI::unescapeHTML, avg 19µs/call # spent 8µs making 8 calls to CGI::CORE:substcont, avg 1µs/call # spent 7µs making 4 calls to CGI::CORE:subst, avg 2µs/call
56 }
57
5817µs1900ns $type .= "; charset=$charset"
# spent 900ns making 1 call to CGI::CORE:match
59 if $type ne ''
60 and $type !~ /\bcharset\b/
61 and defined $charset
62 and $charset ne '';
63
64 # Maybe future compatibility. Maybe not.
6512µs my $protocol = $ENV{SERVER_PROTOCOL} || 'HTTP/1.0';
661300ns push(@header,$protocol . ' ' . ($status || '200 OK')) if $nph;
671200ns push(@header,"Server: " . &server_software()) if $nph;
68
6911µs push(@header,"Status: $status") if $status;
701200ns push(@header,"Window-Target: $target") if $target;
711200ns push(@header,"P3P: policyref=\"/w3c/p3p.xml\", CP=\"$p3p\"") if $p3p;
72 # push all the cookies -- there may be several
7314µs push(@header,map {"Set-Cookie: $_"} @cookie);
74 # if the user indicates an expiration time, then we need
75 # both an Expires and a Date header (so that the browser is
76 # uses OUR clock)
771200ns push(@header,"Expires: " . expires($expires,'http'))
78 if $expires;
7914µs169µs push(@header,"Date: " . expires(0,'http')) if $expires || $cookie || $nph;
# spent 69µs making 1 call to CGI::Util::expires
8018µs1118µs push(@header,"Pragma: no-cache") if $self->cache();
# spent 118µs making 1 call to CGI::AUTOLOAD
811300ns push(@header,"Content-Disposition: attachment; filename=\"$attachment\"") if $attachment;
8214µs push(@header,map {ucfirst $_} @other);
8319µs push(@header,"Content-Type: $type") if $type ne '';
8413µs my $header = join($CRLF,@header)."${CRLF}${CRLF}";
8511µs if (($MOD_PERL >= 1) && !$nph) {
86 $self->r->send_cgi_header($header);
87 return '';
88 }
8918µs return $header;
90}
91
92;